<!-- 折线图组件 -->

<script setup lang='ts'>
import * as Echarts from "echarts"
import { reactive, onMounted,defineProps } from "vue";
const propsData = defineProps(['option'])
// dom对象
let chart: any
let data = reactive({
    isSeriesEmpty: false
})
onMounted(() => {
    chart = Echarts.init(document.getElementById('lineChart'));
    chart.setOption(propsData.option, true)
    window.addEventListener('resize', () => {
        chart.resize()
    })
})
</script>
 
<template>
    <h3 v-if="data.isSeriesEmpty">暂无数据</h3>
    <div v-else id="lineChart">
    </div>
</template>
 
<style scoped>
#lineChart {
    width: 100%;
    height: 100%;
}
</style>